home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: simple code, argc, argv, strcmp()
- Date: Tue, 06 Feb 96 14:01:51 GMT
- Organization: none
- Message-ID: <823615311snz@genesis.demon.co.uk>
- References: <11f7cc$17261a.3b3@daprez> <4etj7c$bma@news.iag.net> <fcusack-0202961621470001@mudskipper.cac.psu.edu> <fcusack-0302961645280001@mudskipper.cac.psu.edu>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <fcusack-0302961645280001@mudskipper.cac.psu.edu>
- fcusack@tdx.org "frank." writes:
-
- >Yes, the && test would never pass, but the || test is bad also. The ||
- >will pass if you pass "-d" or "-e". So then you will call Usage()
- >incorrectly. The test should be:
- >
- > if (!(!strcmp(argv[1], "-d") || !strcmp(argv[1], "-e"))) {
- > Usage();
- > }
-
- That is correct but it is pretty horrible to read. I prefer something like:
-
- if (strcmp(argv[1], "-d") != 0 && strcmp(argv[1], "-e") != 0) {
- ...
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-